package com.kzw.oa.model.info;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties( { "hibernateLazyInitializer", "section", "newsComments" })
public class News implements Serializable {

	protected Long newsId;
	protected String subjectIcon;
	//新闻标题
	protected String subject;
	//作者
	protected String author;
	protected Date createtime;
	//过期时间
	protected Date expTime;
	protected Integer replyCounts;
	//浏览数
	protected Integer viewCounts;
	//发布人
	protected String issuer;
	protected String content;
	protected Date updateTime;
	//0=待审核 1=审核通过
	protected Short status;
	//是否为桌面新闻
	protected Short isDeskImage;
	//新闻还是通知
	protected Integer isNotice;

	protected Integer sn;

	//所属栏目
	protected Section section;
	protected Set<NewsComment> newsComments = new HashSet<NewsComment>();

	/**
	 * 选择范围: 部门
	 */
	protected String recDepIds;
	protected String recDepNames;
	/** 附件 */
	protected String attachIds;
	protected String attachNames;
	

	/**
	 * Default Empty Constructor for class News
	 */
	public News() {
		super();
	}

	/**
	 * Default Key Fields Constructor for class News
	 */
	public News(Long in_newsId) {
		this.setNewsId(in_newsId);
	}

	public Section getSection() {
		return section;
	}

	public void setSection(Section in_section) {
		this.section = in_section;
	}

	public Set<NewsComment> getNewsComments() {
		return newsComments;
	}

	public void setNewsComments(Set<NewsComment> in_newsComments) {
		this.newsComments = in_newsComments;
	}

	public Long getNewsId() {
		return this.newsId;
	}

	/**
	 * Set the newsId
	 */
	public void setNewsId(Long aValue) {
		this.newsId = aValue;
	}

	/**
	 * *
	 * 
	 * @return Long
	 */
	public Long getSectionId() {
		return this.getSection() == null ? null : this.getSection()
				.getSectionId();
	}

	/**
	 * Set the sectionId
	 */
	public void setSectionId(Long aValue) {
		if (aValue == null) {
			section = null;
		} else if (section == null) {
			section = new Section(aValue);
		} else {
			section.setSectionId(aValue);
		}
	}

	public String getSubjectIcon() {
		return this.subjectIcon;
	}

	/**
	 * Set the subjectIcon
	 */
	public void setSubjectIcon(String aValue) {
		this.subjectIcon = aValue;
	}

	/**
	 * 新闻标题
	 */
	public String getSubject() {
		return this.subject;
	}

	/**
	 * Set the subject
	 * 
	 * @spring.validator type="required"
	 */
	public void setSubject(String aValue) {
		this.subject = aValue;
	}


	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date aValue) {
		this.createtime = aValue;
	}

	public Date getExpTime() {
		return this.expTime;
	}


	public void setExpTime(Date aValue) {
		this.expTime = aValue;
	}

	public Integer getReplyCounts() {
		return this.replyCounts;
	}

	/**
	 * Set the replyCounts
	 */
	public void setReplyCounts(Integer aValue) {
		this.replyCounts = aValue;
	}

	public Integer getViewCounts() {
		return this.viewCounts;
	}

	/**
	 * Set the viewCounts
	 */
	public void setViewCounts(Integer aValue) {
		this.viewCounts = aValue;
	}

	public String getIssuer() {
		return this.issuer;
	}

	public void setIssuer(String aValue) {
		this.issuer = aValue;
	}

	public String getContent() {
		return this.content;
	}

	/**
	 * Set the content
	 * 
	 * @spring.validator type="required"
	 */
	public void setContent(String aValue) {
		this.content = aValue;
	}

	public Date getUpdateTime() {
		return this.updateTime;
	}

	/**
	 * Set the updateTime
	 */
	public void setUpdateTime(Date aValue) {
		this.updateTime = aValue;
	}

	public Short getStatus() {
		return this.status;
	}

	/**
	 * Set the status
	 * 
	 * @spring.validator type="required"
	 */
	public void setStatus(Short aValue) {
		this.status = aValue;
	}

	public Short getIsDeskImage() {
		return this.isDeskImage;
	}

	/**
	 * Set the isDeskImage
	 */
	public void setIsDeskImage(Short aValue) {
		this.isDeskImage = aValue;
	}

	public Integer getIsNotice() {
		return this.isNotice;
	}

	/**
	 * Set the isNotice
	 */
	public void setIsNotice(Integer aValue) {
		this.isNotice = aValue;
	}

	public Integer getSn() {
		return this.sn;
	}

	/**
	 * Set the sn
	 */
	public void setSn(Integer aValue) {
		this.sn = aValue;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof News)) {
			return false;
		}
		News rhs = (News) object;
		return new EqualsBuilder().append(this.newsId, rhs.newsId).append(
				this.subjectIcon, rhs.subjectIcon).append(this.subject,
				rhs.subject).append(this.author, rhs.author).append(
				this.createtime, rhs.createtime).append(this.expTime,
				rhs.expTime).append(this.replyCounts, rhs.replyCounts).append(
				this.viewCounts, rhs.viewCounts)
				.append(this.issuer, rhs.issuer).append(this.content,
						rhs.content).append(this.updateTime, rhs.updateTime)
				.append(this.status, rhs.status).append(this.isDeskImage,
						rhs.isDeskImage).append(this.isNotice, rhs.isNotice)
				.append(this.sn, rhs.sn).isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973).append(this.newsId)
				.append(this.subjectIcon).append(this.subject).append(
						this.author).append(this.createtime).append(
						this.expTime).append(this.replyCounts).append(
						this.viewCounts).append(this.issuer).append(
						this.content).append(this.updateTime).append(
						this.status).append(this.isDeskImage).append(
						this.isNotice).append(this.sn).toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("newsId", this.newsId).append(
				"subjectIcon", this.subjectIcon)
				.append("subject", this.subject).append("author", this.author)
				.append("createtime", this.createtime).append("expTime",
						this.expTime).append("replyCounts", this.replyCounts)
				.append("viewCounts", this.viewCounts).append("issuer",
						this.issuer).append("content", this.content).append(
						"updateTime", this.updateTime).append("status",
						this.status).append("isDeskImage", this.isDeskImage)
				.append("isNotice", this.isNotice).append("sn", this.sn)
				.toString();
	}

	public String getRecDepIds() {
		return recDepIds;
	}

	public void setRecDepIds(String recDepIds) {
		this.recDepIds = recDepIds;
	}

	public String getRecDepNames() {
		return recDepNames;
	}

	public void setRecDepNames(String recDepNames) {
		this.recDepNames = recDepNames;
	}

	public String getAttachIds() {
		return attachIds;
	}

	public void setAttachIds(String attachIds) {
		this.attachIds = attachIds;
	}

	public String getAttachNames() {
		return attachNames;
	}

	public void setAttachNames(String attachNames) {
		this.attachNames = attachNames;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

}
